using UnityEngine;
namespace DefaultNamespace.Skill
{
    [CreateAssetMenu(menuName = "Skills/Buff")]
    public class BuffSkill: Skill
    {
        public enum BuffType
        {
            DamageBoost,//伤害增强
            SpeedBoost,
            DefenseBoost
        }
        
        public BuffType buffType;
        public float amount;
        public float duration;
        
        public override void Activate(GameObject caster)
        {
            if (!IsReady()) return;
            
            // Play VFX/SFX
            if (castingVFX) Instantiate(castingVFX, caster.transform.position, Quaternion.identity);
            if (castSound) AudioSource.PlayClipAtPoint(castSound, caster.transform.position);
            
            BuffSystem buffSystem = caster.GetComponent<BuffSystem>();
            if (buffSystem)
            {
                buffSystem.ApplyBuff(new BuffData(buffType.ToString(), amount, duration));
            }
            
            StartCooldown();
        }
    }
}